﻿// Copyright (c) Microsoft Corporation.
// This sample code is provided "as is" without warranty of any kind. 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChangeTrackingApplication.ChangeTrackingServiceReference;
using System.Diagnostics;

namespace ChangeTrackingApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new FMIncCarDocumentServiceClient();
            var chagnedKeysSince = client.getChangedKeys(null, null, 
                DateTime.UtcNow.AddMinutes(-20));

            Debugger.Break();

            var changedDocumentsSince = client.read(null, chagnedKeysSince.EntityKeyList);
            Console.WriteLine("Make, Model, VIN, Status");
            foreach (var carDocument in changedDocumentsSince.FMIncCars_1)
            {
                Console.WriteLine("{0}, {1}, {2}, {3}",
                    carDocument.Make,
                    carDocument.Model,
                    carDocument.VIN,
                    Enum.GetName(typeof(AxdEnum_FMVehicleStatus), carDocument.Status));
            }
            Console.ReadLine();            

            //var date = DateTime.UtcNow;
            //var keys = client.getKeys(null, null);

            //Debugger.Break();

            //var chagnedKeys = client.getChangedKeys(null, null, date);

            //Debugger.Break();
        }
    }
}
